home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-17 | 17.4 KB | 706 lines | [SGPA/SCPG] |
-
- on AutoCreate
- Global oldUsersMeasurements
- global TheCurrentDialog, theDialog, FolderBase
- global The_Style -- Current page style selections.
- set lockcursor to true
- set lockscreen to true
- set MouseCursor to busy
- locatefonts
- put 1 into The_Style
- put 501 into theCurrentDialog
- put ":autocreate:newsletters:" into Folderbase
- open util script FolderBase&"_CTUtility"
-
- put measurements into oldUsersMeasurements
- progressdialog open
- repeat forever
-
- do "put RunDialog" & TheCurrentDialog & "() into theResult"
-
- switch theResult
- case "Next"
- add 1 to theCurrentDialog
- exit switch
- case "Previous"
- subtract 1 from theCurrentDialog
- exit switch
- case "Done"
- Exit repeat
- exit switch
- case "Cancel"
- get dialog(dispose, theDialog)
- exit AutoCreate
- exit switch
- end switch
-
- end repeat
-
-
- -- Build the Pages
- set MouseCursor to busy
-
- progressdialog show "Creating publication…"
- set MouseCursor to busy
- callscript "_NWsetpagesettings"&The_Style, "setpagesettings"
- set MouseCursor to busy
- progressdialog show "Creating pages…"
- callscript "_New Wave "&The_Style, "Build"
-
- if theResult = "Done" then
- get dialog(dispose, theDialog)
- end if
- progressdialog close
- set saveglobals to true
- end AutoCreate
-
- on cleanup
- Global oldUsersMeasurements
- Global TheCurrentDialog, FolderBase
- set lockscreen to true
- put 503 into TheCurrentDialog
- set ShuffleTextObjects to false
-
- set lockcursor to true
- set MouseCursor to busy
- progressdialog open
-
-
- open util script FolderBase&"_CTUtility"
-
- repeat forever
-
- do "put RunDialog" & TheCurrentDialog & "() into theResult"
-
- switch theResult
- case "Next"
- add 1 to theCurrentDialog
- exit switch
- case "Previous"
- subtract 1 from theCurrentDialog
- exit switch
- case "Done"
- Exit repeat
- exit switch
- case "Cancel"
- get dialog(dispose, theDialog)
- publicationsetup columns 1
- set view to sizetofit
- set measurements to oldUsersMeasurements
- exit Cleanup
- end switch
-
- end repeat
-
- callscript "_CTCopyFitEveryStory", "CopyFitEveryStory"
-
- repeat with i = 1 to number of pages -- unlock all objects in doc so user has control
- set currentpage to i
- select all objects
- set locked to false
- end repeat
- set currentpage to 1
- select empty
-
- publicationsetup columns 1
- set view to sizetofit
- set displayguides to false
- set measurements to oldUsersMeasurements
- end cleanup
-
-
-
- function RunDialog501
- -- Phase I, initial options.
- Global The_Style -- Scripted Pages to use.
- Global theDialog
-
- put 2 into Num_Columns -- Number of columns
- put 1 into Num_Stories -- Number of stories
-
- put dialog(preload, 501) into theDialog
-
- set MouseCursor to busy
-
- -- Disable buttons
- SetDialogItem 3,"Disabled" -- Place Graphics
- SetDialogItem 4,"Disabled" -- Place Text
-
- -- Set default options
- SetDialogItem 7,"Set" -- 1 story
- SetDialogItem 8,"Clear" -- 2 stories
-
- -- Define action procs
- SetDialogItem 9, "Box" -- "Number of Columns Box"
- SetDialogItem 21, "Box" -- Page Navigator
- setDialogitem 14, "graybox"
-
- SetDialogItem 19, "Disabled" -- Prev page button
-
- put 1014 into Max_Pages_1
- put 1023 into Max_Pages_2
- put 1011 into Min_Pages_1
- put 1021 into Min_Pages_2
-
- put 1011 into page_one
- put 1012 into page_two
- put 1 into The_Style
-
- repeat forever
-
- SetDialogItem 15,"Picture", PAGE_ONE
- SetDialogItem 23,"Picture", PAGE_TWO
-
- get dialog(display, theDialog)
-
- Switch it
- -- Done Button.
- case 1
- put "Done" into theResult
- exit repeat
- exit switch
-
- -- Cancel button
- case 2
- put "Cancel" into theResult
- exit repeat
- exit switch
-
- -- Help
- case 5
- helpdialog 501, "Autocreate - New Wave Newsletter Options"
- SetDialogItem 15,"Picture", PAGE_ONE
- SetDialogItem 23,"Picture", PAGE_TWO
- exit switch
-
- -- 2 Story
- case 7
- put 1 into The_Style
- put 1011 into PAGE_ONE
- put 1012 into PAGE_TWO
- SetDialogItem 19, "Disabled" -- Prev Page
- SetDialogItem 20, "Enabled" -- Next Page
- exit switch
-
- -- 1 story
- case 8
- put 2 into The_Style
- put 1021 into PAGE_One
- put 1022 into PAGE_TWO
- SetDialogItem 19, "Disabled" -- Prev Page
- SetDialogItem 20, "Enabled" -- Next Page
- exit switch
-
- case 19 -- Prev page button
- SetDialogItem 20, "Enabled" -- Next Page
- put Page_One - 1 into Page_One
- put Page_Two - 1 into Page_Two
-
- do "put Min_Pages_" & the_style & " into Min_Page"
- if Page_One = Min_Page then
- SetDialogItem 19, "Disabled" -- Prev Page
- end if
- exit switch
-
- case 20 -- Next page button
- SetDialogItem 19, "Enabled" -- Prev Page
- put Page_One + 1 into Page_One
- put Page_Two + 1 into Page_Two
-
- do "put Max_Pages_" & the_style & " into Max_Page"
- if Page_Two = Max_Page then
- SetDialogItem 20, "Disabled" -- Prev Page
- end if
- exit switch
-
- end switch
-
- end repeat
-
- return theResult
- end RunDialog501
-
-
-
- function RunDialog503
- Global TotalStories, theStories, vHelvetica, The_Style
- -- Phase III, Page Options.
- progressdialog show "Preparing Options Dialog…"
- put false into UpdateProxy
- put false into MakeJumpLines
- put false into IncludeTOC
- put "unknown" into TheResult
- set currentPage to 1
-
- put dialog(preload, 503) into theDialog
- set MouseCursor to busy
-
- SetDialogItem 11, "Box" -- Action proc for Folio Options
- SetDialogItem 16, "Box" --Action proc for Document Options
- SetDialogItem 19, "GrayBox" -- Action proc for Preview Box
-
- put "unknown" into TheStories
-
- set currentpage to 1
-
- -- Set Volume name and date settings
- put item 2 to 3 of date(long) into THE_DATE -- Date = "February 5, 1992"
- delete char 1 of THE_DATE
-
- SetDialogItem 8, "Set","Contents", "New Wave Edition" -- Publication Name.
- SetDialogItem 4, "Contents", "Volume 1, Number 1" -- Volume.
- SetDialogItem 5, "Contents", THE_DATE -- Date.
-
- -- Setup items on the page.
- put "N e w W a v e E d i t i o n" into story "Publication Name"
- select all text in story "Publication Name"
- set styleRecomposition to false
- set RulerJustification to Forced
- Set TextSize to 40
- set textfont to vhelvetica
- set textface to plain
- set textface to italic
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- select text char 1 of word 1 of story "Publication Name"
- set textface to bold
- select text char 1 of word 4 of story "Publication Name"
- set textface to bold
- select text char 1 of word 8 of story "Publication Name"
- set textface to bold
- set styleRecomposition to true
- copyfit
- put "New Wave Edition" into OldPubTitle
-
- put THE_DATE into story "Date"
- Select all text in Story "Date"
- set styleRecomposition to false
- set RulerJustification to left
- Set TextSize to 14
- set textfont to vhelvetica
- set textface to plain
- set textface to italic
- set styleRecomposition to true
- copyfit
- put THE_DATE into OldDate
-
- put "Volume 1, Number 1" into story "Volume"
- Select all Text in story "Volume"
- set styleRecomposition to false
- set TextSize to 14
- set textfont to vhelvetica
- set textface to plain
- set textface to italic
- set styleRecomposition to true
- copyfit
-
- put "Volume 1, number 1" into OldVolume
-
- callscript "_NWSetStoryFonts", "SetStoryFonts"
-
- SetDialogItem 21,"Proxy" -- Update Proxy.
-
- repeat forever
- get dialog(display, theDialog)
-
- switch it
-
- case 1 -- Next Button
- put "Next" into theResult
- put true into UpdateProxy
- exit switch
-
- case 6
- put hilited(item6) into MakeJumpLines
- exit switch
-
- case 3
- helpdialog 503, "Autocreate - Other Newsletter Options"
- put true into updateProxy
- exit switch
-
- case 2 -- Update
- case 21
- case 20
- case 19 --User Force Update Preview Proxy
- put true into UpdateProxy
- exit switch
-
- end switch
-
- if UpdateProxy then
- -- Check if Publication Title has been modified
- if OldPubTitle ≠ ContentsOf(item8) then
- put ContentsOf(item8) into OldPubTitle
- put OldPubTitle into story "Publication Name"
- select all text of story "Publication Name"
- set styleRecomposition to false
- set textfont to vhelvetica
- set RulerJustification to Forced
- Set TextSize to 40
- set textface to plain
- set textface to italic
-
- -- Set initial Character to Bold
- repeat with x = 1 to number of words in story "Publication Name"
- select text char 1 of word x of story "Publication Name"
- set textface to bold
- end repeat
- -- Space out the pub title
- repeat with x = (number of chars in story "Publication Name")-1 down to 1
- put " " after char x of story "Publication Name"
- end repeat
-
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
- -- Check if Date has been modified
- if OldDate ≠ ContentsOf(item5) then
- put ContentsOf(item5) into OldDate
- put OldDate into story "Date"
- select all text in story "Date"
- set styleRecomposition to false
- Set TextSize to 12
- set textfont to vhelvetica
- set textface to plain
- set textface to italic
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- end if
-
- -- Check if Volume has been modified
- if OldVolume ≠ ContentsOf(item4) then
- put ContentsOf(item4) into OldVolume
- put OldVolume into story "Volume"
- select all text in story "Volume"
- set styleRecomposition to false
- Set TextSize to 12
- set textfont to vhelvetica
- set textface to plain
- set textface to italic
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
-
- SetDialogItem 21,"Proxy" -- Update Proxy.
- put false into UpdateProxy
- end if
-
- if TheResult = "Next" then
- if MakeJumpLines then
- set mousecursor to busy
- progressdialog show "Creating "& quote & "Continued from" & quote & " lines…"
- if The_Style = 1 then
- doOneStoryJumpLines
- else
- callscript "_CTCreateJumpLines", "CreateJumpLines"
- end if
- end if
- exit repeat
- end if
- end repeat
- get dialog(dispose, theDialog)
- return theResult
- End RunDialog503
-
- on doOneStoryJumpLines
- global vHelvetica
-
- repeat with thepage = 1 to 3
- set currentpage to thepage
- open story "jumpline "&thepage
- draw rectangle in inches from 5.5,9.583 to 7.514,9.93
- close story
- -- Enter text into obj.
-
- put ("continued on page " & (thepage +1)) into story ("jumpline "&thepage)
- set textwrap of last object to 0 aRoundRect
- set linePattern of last object to 0
- select all text in story ("jumpline "&thepage)
- set textRecomposition to false
- set textfont to vHelvetica
- set RulerJustification to right
- set textface to italic
- set textRecomposition to true
- set flexibleCharSize to false
- Set flexibleLeading to false
- Set flexibleCharSize to false
- set textsize to 8
- end repeat
- end doOneStoryJumpLines
-
- function RunDialog504
- Global TotalStories, theStories, vHelvetica
- -- Headline Editor.
- set shuffleTextObjects to false
- progressdialog show "Preparing headline dialog…"
- put dialog(preload, 504) into theDialog
-
- -- Action proc for Headline Entry Box
- SetDialogItem 11, "Box"
-
- -- Action proc for Divider line.
- SetDialogItem 14, "Box"
-
- -- Action proc for Text Proxie
- SetDialogItem 6, "Box"
-
-
- put empty into theResult
- -- Preset the Headlines
- repeat with x = 1 to TotalStories
- put item x of TheStories into TheTempStory
- set itemdel to "\"
- put item 3 of TheTempStory into ThePage -- Get Page.
- set itemdel to ","
- set currentpage to ThePage -- Go to that page.
- put empty into TempHold
- put paragraph 1 of story item 1 of storyloc of object (item x of TheStories) after TempHold
- set the itemdel to numtochar(1)
- put tempHold into item x of TheCurrentTitles
- set itemdel to ","
- end repeat
-
- progressdialog hide
- if TotalStories = 0 then exit RunDialog504
- -- If only one story, then grey the next and prev buttons
- if TotalStories = 1 then
- SetDialogItem 4,"Disabled" -- Prev Headline.
- SetDialogItem 3,"Disabled" -- Next Headline.
- end if
-
- -- Tell user # of stories
- put "This publication has x headline(s). Personal Press has selected the " & ¬
- "first paragraph of the story for the headline. Make sure each headline is " &¬
- "correct or type a new headline. " into TheInstructions
- put TotalStories into word 4 of TheInstructions
- SetDialogItem 9, "Text", TheInstructions
-
- put 1 into CurrentStoryNum -- Holds the current story number.
-
- -- Do every story in the pub.
- repeat forever
- put item CurrentStoryNum of TheStories into CurrentStoryName
-
- set itemdel to "\"
- set currentpage to item 3 of CurrentStoryName
- set itemdel to ","
-
- --Story preview box, Get the 1st 240 chars of the story.
- put empty into TheStory
- put trunctext( story item 1 of storyloc of object CurrentStoryName, 245 ) ¬
- after TheStory
- SetDialogItem 15, "Enabled","Text", TheStory
-
- -- Set name of story in the Headlines dialog box.
- SetDialogItem 16,"Text", "Contents", quote & ¬
- username of story (item 1 of storyloc of object CurrentStoryName) & quote
-
- -- Set the current headline.
- set itemdel to numtochar(1)
- put item CurrentStoryNum of TheCurrentTitles into TheHeadline
- set itemdel to ","
- SetDialogItem 10,"Set","Contents",TheHeadline
-
- -- Set Headline Preview Proxy
- select empty
- set the itemdel to "\"
- select objects where word 2 of item 2 of name of this object = "Title" and¬
- (word 2 of name of object CurrentStoryName = word 2 of name of this object)
- set the itemdel to ","
- put selectedobjects() into objs
- repeat with q = 1 to number(items in objs)
- put item q of objs into y
- -- Put the name of this object into the Title object.
- put TheHeadline into story item 1 of storyloc of object y
- select all text in story item 1 of storyloc of object y
- set styleRecomposition to false
- set textsize to 20
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- put empty into isTitle
- end repeat -- Objects
-
- if (CurrentStoryNum = TotalStories) and (TotalStories > 1) then
- SetDialogItem 3,"Disabled" -- Next Headline.
- SetDialogItem 4,"Enabled" -- Prev Headline.
- else if (CurrentStoryNum = 1) and (TotalStories > 1) then
- SetDialogItem 3,"Enabled" -- Next Headline.
- SetDialogItem 4,"Disabled" -- Prev Headline.
- else if (CurrentStoryNum ≠ 1) and (TotalStories > 1) ¬
- and (CurrentStoryNum ≠ TotalStories) then
- SetDialogItem 3,"Enabled" -- Next Headline.
- SetDialogItem 4,"Enabled" -- Prev Headline.
- end if
-
- -- Handle the dialog.
- repeat forever
- get dialog(display, theDialog)
-
- switch it
-
- case 19 -- Next Button
- put "Next" into theResult
- put ContentsOf(item10) into TheHeadline
- set itemdel to numtochar(1)
- put TheHeadline into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- exit repeat
- exit switch
-
- case 3 -- "Next Headline"
- put ContentsOf(item10) into TempHold
- set itemdel to numtochar(1)
- put TempHold into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- put 1+CurrentStoryNum into CurrentStoryNum
- if CurrentStoryNum > TotalStories then
- put TotalStories into CurrentStoryNum
- end if
- exit repeat
- exit switch
-
- case 4 -- "Prev Headline"
- put ContentsOf(item10) into tempHold
- set itemdel to numtochar(1)
- put TempHold into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- put CurrentStoryNum - 1 into CurrentStoryNum
- if CurrentStoryNum < 1 then put 1 into CurrentStoryNum
- exit repeat
- exit switch
-
- case 5
- helpdialog 504, "Autocreate - Headline Editor"
- SetDialogItem 9, "Text", TheInstructions
- SetDialogItem 15, "Enabled","Text", TheStory
- exit switch
-
-
- end switch
- end repeat -- Dialog Handler.
-
-
- if (TheResult = "Next") then
- -- Assign the titles.
- put CurrentPage into OldPage
- set mousecursor to busy
- progressdialog show "Installing headlines…"
- repeat with x = 1 to TotalStories
- set mousecursor to busy
- put item x of TheStories into TempStory -- Get the story.
- set itemdel to "\"
- put item 3 of TempStory into StoryCurrentPage -- Set the stories' page.
- set itemdel to ","
- put word 2 of item x of TheStories into TheStoryObject
-
- -- Look for title objects.
- repeat with p = 1 to number of pages -- go thru all pages.
- set currentpage to p
- select empty
- put word 2 of item x of TheStories into stynum
- set the itemdel to "\"
- select objects where word 2 of item 2 of name of this object = "Title" and¬
- stynum = word 2 of name of this object
- set the itemdel to ","
- put selectedobjects() into objs
- repeat with q = 1 to number(items in objs)
- put item q of objs into y
- put word 2 of name of object y into TheSearchObject
-
- set itemdel to numtochar(1)
- put item x of theCurrentTitles into TheChangedHeadLine
- set itemdel to ","
-
- put TheChangedHeadline into story item 1 of storyloc of object y
- select all text in story item 1 of storyloc of object y
- set styleRecomposition to false
- set textfont to vHelvetica
- set textsize to 20
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
-
- set mousecursor to busy
- --Check the 1st ¶ to see if same as headline -- if Yes, Delete it.
- set currentpage to StoryCurrentPage
- put paragraph 1 of story item 1 of storyloc of object (item x of TheStories)¬
- into TheCurrentHeadline
- if TheCurrentHeadline = TheChangedHeadline then
- delete paragraph 1 of story item 1 of storyloc¬
- of object (item x of TheStories)
- end if
- set currentpage to p
-
-
- end repeat -- Objects
- end repeat -- pages.
-
- end repeat -- Stories.
- set currentpage to OldPage
-
- exit repeat -- We're Done!
- end if
- end repeat -- Story Count.
- get dialog(dispose, theDialog)
- return theResult
- End RunDialog504
-
- function RunDialog505
- callscript "_CTMakePullQuotes", "MakePullQuotes"
- return "next"
- end RunDialog505
-
- function RunDialog506
- callscript "_CTMakeCaptions", "MakeCaptions"
- return "Done"
- end RunDialog506
-
-
- on callscript file, message
- global FolderBase
- open script FolderBase&file
- do message
- close script FolderBase&file
- end callscript
-
-
-
- on locatefonts
- global vHelvetica, vPalatino, vTimes, vNewYork, systemfonts
- put fontfamilies into systemfonts
- if systemfonts contains "New York" then put "New York" into vNewYork
- else put "Geneva" into vNewYork
- if systemfonts contains "helvetica" then put "helvetica" into vHelvetica
- else put "Geneva" into vHelvetica
- if systemfonts contains "Times" then put "Times" into vTimes
- else put vNewYork into vTimes
- if systemfonts contains "Palatino" then put "Palatino" into vPalatino
- else put vTimes into vPalatino
- put vHelvetica into vTimes -- a little trick to make all fonts Helvetica family
- put vHelvetica into vPalatino -- a little trick to make all fonts Helvetica family
-
-
- end locatefonts
-
-
- on autoCreateHelp
- helpdialog 500, "Autocreate - Place text and graphics"
- set saveglobals to true
- end autoCreateHelp
-